package cn.piesat.scanning.business.xz;

import cn.piesat.scanning.utils.SpringContextHelper;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

@Component
public class BuildAlgorithmFactory {

    private static Map<String,String> typeBeansMapper = new HashMap<>();

    @PostConstruct
    public void init(){
        //基础植被指数计算
        typeBeansMapper.put("XIZANG_VEG","buildXIZANG_VEGServiceImpl");
        //卫星云检测产品反演
        typeBeansMapper.put("XIZANG_CLM","buildXIZANG_CLMServiceImpl");
        //卫星陆表温度产品反演
        typeBeansMapper.put("XIZANG_LST","buildXIZANG_LSTServiceImpl");

        //TODO 草地子系统(GSE)
        //草地碳汇GPP算法
        typeBeansMapper.put("XIZANG_GSE_GPP","buildXIZANG_GPPServiceImpl");
        //草地碳汇NPP算法
        typeBeansMapper.put("XIZANG_GSE_NPP","buildXIZANG_GPPServiceImpl");
        //草地碳汇NEP算法
        typeBeansMapper.put("XIZANG_GSE_NEP","buildXIZANG_GPPServiceImpl");
        //草地碳汇对植被相关性分析,例:FY3D_GPP对NDVI相关性分析
        typeBeansMapper.put("Tibet_Grass_RPP","buildTibet_Grass_RPPServiceImpl");
        //草地类型去年同期变化
        typeBeansMapper.put("Tibet_Grass_GCT","buildTibet_Grass_GCTServiceImpl");
        typeBeansMapper.put("Tibet_Grass_GCJ","buildTibet_Grass_GCTServiceImpl");
        //草地产品掩膜
        typeBeansMapper.put("Tibet_Grass_Mask","buildTibet_Grass_MaskServiceImpl");
        //草地_生物量_季年合成
        typeBeansMapper.put("Tibet_Prod_COMB","buildTibet_Prod_COMBServiceImpl");
        //草地去年同期算法
        typeBeansMapper.put("Tibet_Grass_PTB","buildTibet_Grass_PTBServiceImpl");
        //草地历史同期算法
        typeBeansMapper.put("Tibet_Grass_PJP","buildTibet_Grass_PJPServiceImpl");
        //草地综合植被盖度
        typeBeansMapper.put("Tibet_Grass_CVC","buildTibet_Grass_CVCServiceImpl");
        //草地分类
        typeBeansMapper.put("Tibet_Grass_GCF","buildTibet_Grass_GCFServiceImpl");
        //草地生长期
        typeBeansMapper.put("Tibet_Grass_GSL","buildTibet_Grass_GSLServiceImpl");
        //草地返青期
        typeBeansMapper.put("Tibet_Grass_SOS","buildTibet_Grass_SOSServiceImpl");
        //草地枯黄期
        typeBeansMapper.put("Tibet_Grass_EOS","buildTibet_Grass_SOSServiceImpl");
        //禁牧区草地植被指数算法
        typeBeansMapper.put("Tibet_Grass_PGA","buildElseServiceImpl");
        //草地地上生物量（含干草）
        typeBeansMapper.put("Tibet_Grass_AGB","buildElseServiceImpl");
        //草地鲜草生物量
        typeBeansMapper.put("Tibet_Grass_FAGB","buildElseServiceImpl");
        //物候期年际变化算法
        typeBeansMapper.put("Tibet_Grass_WYS","buildTibet_Grass_WYSServiceImpl");
        //天擎_气象要素_插值
        typeBeansMapper.put("Tibet_CIA","buildTibet_CIAServiceImpl");
        //天擎_气象要素_插值去年同期
        typeBeansMapper.put("Tibet_CTB","buildTibet_CTBServiceImpl");
        //天擎_气象要素_插值历史同期
        typeBeansMapper.put("Tibet_CJP","buildTibet_CJPServiceImpl");

        //TODO 湿地子系统(WER)
        //湿地产品掩膜
        typeBeansMapper.put("Tibet_Wetland_Mask","buildTibet_Grass_MaskServiceImpl");
        //湿地去年同期算法
        typeBeansMapper.put("Tibet_Wetland_PTB","buildTibet_Grass_PTBServiceImpl");
        //湿地历史同期算法
        typeBeansMapper.put("Tibet_Wetland_PJP","buildTibet_Grass_PJPServiceImpl");
        typeBeansMapper.put("GF_WER_CLSS","buildGF_WER_GLSSServiceImpl");

        //TODO 森林子系统(FOR)
        //森林碳汇GPP算法
        typeBeansMapper.put("XIZANG_FOR_GPP","buildXIZANG_GPPServiceImpl");
        //森林碳汇NPP算法
        typeBeansMapper.put("XIZANG_FOR_NPP","buildXIZANG_GPPServiceImpl");
        //森林碳汇NEP算法
        typeBeansMapper.put("XIZANG_FOR_NEP","buildXIZANG_GPPServiceImpl");
        //森林地上生物量AGB算法
        typeBeansMapper.put("XIZANG_FOR_AGB","buildXIZANG_FOR_AGBServiceImpl");
        //森林蓄积量FSV算法
        typeBeansMapper.put("XIZANG_FOR_FSV","buildXIZANG_FOR_FSVServiceImpl");
        //森林碳汇对植被相关性分析,例:FY3D_GPP对NDVI相关性分析
        typeBeansMapper.put("XIZANG_FOR_PP","buildXIZANG_FOR_PPServiceImpl");
        //森林历史同期算法
        typeBeansMapper.put("XIZANG_FOR_DIFFJ","buildXIZANG_FOR_DIFFJServiceImpl");
        //森林去年同期算法
        typeBeansMapper.put("XIZANG_FOR_DIFFT","buildXIZANG_FOR_DIFFTServiceImpl");

        //TODO 湖泊子系统(LKR)
        //日尺度湖泊水体面积提取算法
        typeBeansMapper.put("LAKE_WATER","buildLAKE_WATERServiceImpl");

        //TODO 干旱子系统(DRT)
        //干旱指数同期对比
        typeBeansMapper.put("XIZANG_DRT01","buildXIZANG_DRT01ServiceImpl");
        typeBeansMapper.put("TVDI","buildTVDIServiceImpl");
        typeBeansMapper.put("XIZANG_VSWI","buildVSWIServiceImpl");
        typeBeansMapper.put("XIZANG_TCI","buildXIZANG_TCIServiceImpl");
        typeBeansMapper.put("XIZANG_VCI","buildXIZANG_TCIServiceImpl");
        //气象干旱指数计算
        typeBeansMapper.put("XIZANG_SPI_MCI","buildXIZANG_SPI_MCIServiceImpl");


        //TODO 火情子系统(FIR)
        //火情信息监测算法
        typeBeansMapper.put("FIR","buildFIRServiceImpl");

        //TODO 鼠虫害子系统(MID)
        typeBeansMapper.put("XIZANG_MID_ALG","buildXIZANG_MID_ALGServiceImpl");

        //TODO 积雪子系统(SNW)
        //积雪覆盖判识
        typeBeansMapper.put("04_SNWC","build04_SNWCServiceImpl");
        //积雪边缘线
        typeBeansMapper.put("05_SNWL","build05_SNWLServiceImpl");
        //积雪深度监测
        typeBeansMapper.put("01_SNSD","build01_SNSDServiceImpl");
        //积雪深度预测
        typeBeansMapper.put("02_SDFC","build02_SDFCServiceImpl");
        //积雪灾害分级
        typeBeansMapper.put("03_ZHFJ","build03_ZHFJServiceImpl");

        //TODO 生态子系统(ECQ)
        //EVCI植被覆盖指数计算
        typeBeansMapper.put("EVCI","buildEVCIServiceImpl");
        //WNDI水网密度指数计算
        typeBeansMapper.put("WNDI","buildWNDIServiceImpl");
        //WCI水源涵养指数计算
        typeBeansMapper.put("WCI","buildWNDIServiceImpl");
        //HI热度指数计算
        typeBeansMapper.put("HI","buildHIServiceImpl");
        //GI绿度指数计算
        typeBeansMapper.put("GI","buildGIServiceImpl");
        //DI干度指数计算
        typeBeansMapper.put("DI","buildDIWIServiceImpl");
        //WI湿度指数计算
        typeBeansMapper.put("WI","buildDIWIServiceImpl");
        //DIST去年同期和往年同期对比统计
        typeBeansMapper.put("DIST","buildDISTServiceImpl");
        //WSCI水土保持指数计算
        typeBeansMapper.put("WSCI","buildWSCIServiceImpl");
        //ECQ-WSFI防风固沙指数计算
        typeBeansMapper.put("WSFI","buildWSFIServiceImpl");
        //ECQ-RSEI遥感生态指数计算
        typeBeansMapper.put("RSEI","buildRSEIServiceImpl");


        //TODO 客户端合成出图算法
        //FY3E卫星预处理算法
        typeBeansMapper.put("FY3E_MERSI_L1_1000M","buildFY3E_MERSI_L1_1000MServiceImpl");
        //FY3D_L3级合成算法
        typeBeansMapper.put("FY3D_MERSI_L3_1000M","buildFY3D_MERSI_L3_1000MServiceImpl");
        //FY3D_L1级预处理算法
        typeBeansMapper.put("FY3D_MERSI_L1_1000M","buildFY3D_MERSI_L1_1000MServiceImpl");
        typeBeansMapper.put("HB_FY3D_MERSI_L1_1000M","buildFY3D_MERSI_L1_1000MServiceImpl");
        //FY4A_L1级预处理算法
        typeBeansMapper.put("FY4A_AGRI_L1_4000M","buildFY4A_AGRI_L1_4000MServiceImpl");
        //MODISL1级预处理算法
        typeBeansMapper.put("MODIS_L1_1000M","buildMODIS_L1_1000MServiceImpl");
        //葵花9L1级预处理算法
        typeBeansMapper.put("H9_AHI_L1_2000M","buildH9_AHI_L1_2000MServiceImpl");
        //哨兵卫星预处理算法
        typeBeansMapper.put("S2B_MSI_L1_20M","buildS2B_MSI_L1_20MServiceImpl");
        //LAD8,LAD9卫星预处理算法
        typeBeansMapper.put("LAD89_OLITIRS_L1_30M_L2SP","buildLAD89_OLITIRS_L1_30M_L2SPServiceImpl");
        //L1E,L1F几何精校正
        typeBeansMapper.put("ImageRectify","buildImageRectifyServiceImpl");
        //GF1预处理算法
        typeBeansMapper.put("GF_L1","buildGF_L1ServiceImpl");
        //NPP
        typeBeansMapper.put("NOAA20_VIIRS_L1_1000M","buildGF_L1ServiceImpl");
        typeBeansMapper.put("NOAA18_AVHRR_L1_1000M","buildNOAA18_AVHRR_L1_1000MServiceImpl");
        typeBeansMapper.put("NOAA19_AVHRR_L1_1000M","buildNOAA19_AVHRR_L1_1000MServiceImpl");

        //TODO 河北项目算法
        //H9卫星预处理算法
        typeBeansMapper.put("HB_H9_AHI_L1_2000M","buildHB_H9_AHI_L1_2000MServiceImpl");
        //FY4A QPE产品合成算法
        typeBeansMapper.put("HB_FY4A_AGRI_L3_4000M_QPE","buildHB_FY4A_AGRI_L3_4000M_QPEServiceImpl");
        //FY3E卫星预处理算法
        typeBeansMapper.put("HB_FY3E_MERSI_L1_1000M","buildHB_FY3E_MERSI_L1_1000MServiceImpl");
        typeBeansMapper.put("HB_FY4A_AGRI_L1_4000M","buildHB_FY4A_AGRI_L1_4000MServiceImpl");
        //气象干旱指数计算
        typeBeansMapper.put("HB_SPI_SPEI","buildXIZANG_SPI_MCIServiceImpl");
        //云检测算法
        typeBeansMapper.put("HB_CLM","buildHB_CLMServiceImpl");
        //陆表温度
        typeBeansMapper.put("HB_LST","buildHB_LSTServiceImpl");
        //基础植被指数计算
        typeBeansMapper.put("HEBEI_VEG","buildHB_VEGServiceImpl");
        //垂直干旱指数
        typeBeansMapper.put("HEBEI_PDI","buildHB_VEGServiceImpl");
        //FY4A玉米渍涝算法
        typeBeansMapper.put("FY4A_YMWL","buildHB_FY4A_YMWLServiceImpl");
        typeBeansMapper.put("HB_NPP_VIIRS_L1_0375M","buildHB_NPP_VIIRS_L1_0375MServiceImpl");
        typeBeansMapper.put("HB_NPP_VIIRS_L1_0750M","buildHB_NPP_VIIRS_L1_0750MServiceImpl");
    }

    public Object getBuildParamsInstance(String type) {
        if (!typeBeansMapper.containsKey(type) || type == null) {
            return null;
        }
        return  SpringContextHelper.getApplicationContext().getBean(typeBeansMapper.get(type));
    }
}
